<div class="clearfix user-center-head">
  <strong class="pull-left normal"><?php echo L('aftermarket_recoud')?></strong>
  <a href="<?php echo url('user/order_purchase_product_list');?>" class="pull-right btn"><?php echo L('request_record')?></a>
</div>
<div class="clearfix">
  <?php $purchaseStatus = OrderModel::$purchaseStatus;?>
  <span class="mr1x"><?php echo L('order_processing');?>:</span>
  <div class="select-widget">
    <i></i>
    <span>
      <?php
          if($pursta > 0){
              echo L($purchaseStatus[$pursta]);
          }else{
              echo L('any');
          }
      ?>
    </span>
    <?php
      if($purchaseStatus):
    ?>
    <select name="purchase_status" id="purchase_status">
      <option value="" ><?php echo L('any')?></option>
      <?php
          foreach($purchaseStatus as $purchase => $key):
      ?>
      <option value="<?php echo $purchase;?>" <?php if($purchase == $pursta)echo 'selected';?> ><?php echo L($key);?></option>
      <?php
          endforeach;
      ?>
    </select>
    <?php
      endif;
    ?>
  </div>
</div>
<table class="table-list">
  <tbody>
    <?php
  if(isset($purchaseList) && $purchaseList):
  	foreach ($purchaseList as $pur) :
  ?>
    <tr>
      <td width="10%"><?php echo $pur['id'];?></td>
      <td width="25%"><?php echo $pur['order_sn']; ?></td>
      <td width="20%"><?php echo $pur['product_name'];?></td>
      <td width="20%"><?php echo date('Y-m-d', $pur['add_time'])?></td>
      <td width="15%"><?php echo L($purchaseStatus[$pur['status']]);?></td>
      <td width="10%"><a href="<?php echo url('user/order_purchase_edit', array('pur_id' => $pur['id']));?>"><?php echo L('view_address')?></a></td>
    </tr>
    <?php endforeach;
			else:
?>
    <tr>
      <td colspan="6" class="no-record"><?php echo L('norecords')?></td>
    </tr>
    <?php endif;?>
  </tbody>
</table>
<script type="text/javascript">
$('#purchase_status').change(function(){
	var psid = $('#purchase_status').val()

	if(psid){
		window.location.href='/user/order_purchase_list/purchase_status/'+psid;
	}else{
		window.location.href='/user/order_purchase_list';
	}
});
</script>